<%@ page import="java.util.*"
         import="com.namabank.util.*"
         import="java.lang.*"
         import="java.math.*"
         import="org.hibernate.*"
         import="org.json.*"
         import="java.io.File"
         import="org.jsoup.select.Elements"
         import="org.jsoup.parser.Parser"
         import="org.jsoup.nodes.Element"
         import="com.namabank.servlet.EvaluateParam"
contentType="text/html; charset=UTF-8"%><%@include  file="WEB-INF/jspf/commons/common-func.jspf"%><%
            String contextpath = request.getContextPath();
            String ulRole = null;
            String sessionid = (String) request.getAttribute("sessionid");
            if (sessionid == null) {
                sessionid = "";
            }
            EvaluateParam evalParam = (EvaluateParam) request.getAttribute("evalparam");
            if (evalParam != null) {
                TemplateFile tr = new TemplateFile();
                ulRole = tr.readTemplateHTML("WEB-INF/role/helpdesk_role.html");
                Element bodyTag = Parser.parseBodyFragment(ulRole, "").body();
                evalParam.constrainRole(bodyTag);

                Elements lisRoleNeedHave = bodyTag.select("[href]");
                for (int i = 0; i < lisRoleNeedHave.size(); i++) {
                    Element curEle = lisRoleNeedHave.get(i);
                    String href = curEle.attr("href");
                    if (href == null || href.length() == 0) {
                        continue;
                    }
                    curEle.attr("href", request.getContextPath() + href);
                }

                request.setAttribute("ul_role", bodyTag.html());
                ulRole = bodyTag.html();
            }
            String userId = "", userName = "", branchCode = "", branchName = "";
            String welcomeText = "";
            if (ulRole == null) {
                ulRole = "";
            }
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Chuong trinh ho tro Flexcube</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
        <link rel="shortcut icon" href="<%=getFullPath(request, "images/favicons.ico")%>" type="image/x-icon" />

        <link type="text/css" href="<%=getFullPath(request, getFileLastModifiedAfterPath("templates/default/jquery-ui-1.8.6.css"))%>" rel="stylesheet"/>
        <link type="text/css" href="<%=getFullPath(request, getFileLastModifiedAfterPath("templates/default/template_css.css"))%>" rel="stylesheet"/>

        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery-1.5.2.min.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("templates/default/js/jquery-ui-1.8.6.min.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery-othlib.min.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery.layout1.3.29.14.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery.treeview.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery.jqGrid.min.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/hien.common.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/nicEdit.js"))%>"></script>
        <style type="text/css">
            #cpBackgroundImg {
                left:0px;
                position:absolute;
                top:0;
                z-index:0;
            }
            .text-on-deskboard{
                color:white;
            }
        </style>
    </head>
    <body>
        <div class="ui-layout-north">
            <div id="nabcm-header">
                <a class="logo">NGÂN HÀNG NAM Á</a>
                <div class="header-user-title" style="left: 230px;bottom:0;position: absolute;padding:0px 3px;">
                    <%=welcomeText%>
                </div>
                <div class="header-button-pane">
                    <button onclick="logout();">Thoát</button>
                </div>
            </div>
        </div>
        <div class="ui-layout-west">
            <div class="header">Danh sách chức năng</div>
            <div class="content">
                <%=ulRole%>
            </div>
        </div>
        <div id="root-layout-content">
            <h3 class="header" style="margin:0;" id="pagetext">&nbsp;</h3>
            <div class="main-content content" style="padding: 5px;">
                <div id="window-content-area" style="min-width:500px;">
                </div>
            </div>
        </div>
        <div id="response-param" style="display:none;">
            <%
                        if (evalParam != null) {
                            String responseHtml = evalParam.getResponseString();
                            out.print(responseHtml);
                        }
            %>
        </div>
        <div style="display: none;" id="trash-area-for-remove"></div>
    </body>
    <script type="text/javascript">
        document.b_sessionid = '<%=sessionid%>';
        document.b_userid = '<%=request.getParameter("userid")%>';
        document.b_hdPassword = '<%=request.getParameter("hdPassword")%>';
        var layoutSettings_Outer = {
            name: "outerLayout" // NO FUNCTIONAL USE, but could be used by custom code to 'identify' a layout
            // options.defaults apply to ALL PANES - but overridden by pane-specific settings
            ,defaults: {
                size:"auto",minSize:50,paneClass:"pane",resizerClass:"resizer",togglerClass:"toggler"
                ,buttonClass:"button",contentSelector:".content",contentIgnoreSelector:"span"
                ,togglerLength_open:35// WIDTH of toggler on north/south edges - HEIGHT on east/west edges
                ,togglerLength_closed:35// "100%" OR -1 = full height
                ,hideTogglerOnSlide:true// hide the toggler when pane is 'slid open'
                ,togglerTip_open:"Close This Pane",togglerTip_closed:"Open This Pane"
                ,resizerTip:"Resize This Pane",fxName:"slide"// none, slide, drop, scale
                ,fxSpeed_open:750,fxSpeed_close:1500
                ,fxSettings_open:{ easing: "easeInQuint" }
                ,fxSettings_close:{ easing: "easeOutQuint" }
            }
            ,north: {
                spacing_open:1,togglerLength_open:0,togglerLength_closed:-1
                ,resizable: false,slidable:false,fxName:"none"
            }
            ,west: {size:250,spacing_closed:21
                ,togglerLength_closed:21,togglerAlign_closed:"top",togglerLength_open:0,togglerTip_open:"Thu nhỏ khung nhìn"
                ,togglerTip_closed:"Phóng to khung nhìn",resizerTip_open:"Điều chỉnh kích thước khung nhìn"
                ,slideTrigger_open:"mouseover",initClosed:false,fxSettings_open:{ easing: "easeOutBounce" }
            }
            ,center: {paneSelector:"#root-layout-content",minWidth:200,minHeight:200}
        };
        var outerLayout;
        $(document).ready( function() {
            outerLayout = $("body").layout( layoutSettings_Outer );
            var westSelector = "body > .ui-layout-west"; // outer-west pane
            $("<span></span>").addClass("pin-button").prependTo( westSelector );
            outerLayout.addPinBtn( westSelector +" .pin-button", "west");
            $("<span></span>").attr("id", "west-closer" ).prependTo( westSelector );
            $(".ui-layout-west .content ul a").each(function(){
                var $this = $(this);
                if(!$this.attr("href")){
                    var $span = $("<span>" + $this.html() + "</span>");
                    for(var i = 0; i < this.attributes.length; i++){
                        $span.attr(this.attributes[i].nodeName, this.attributes[i].nodeValue);
                    }
                    $span.prependTo($this.parent());
                    $this.remove();
                }
            });
            $(".ui-layout-west .content ul:first").treeview({animated: "normal"});
            $(".ui-layout-west ul.treeview a").click(function(event){
                event.preventDefault();
                var $this = $(this);
                if($this.attr("href")){
                    var param = {};
                    param.module = $this.attr("module");
                    param.state = $this.attr("state");
                    postData($this.attr("href"), param, true, function(data){
                        if(defaultPostSuccess(data) != null){
                            $(".ui-layout-west .treeview li.item-active").removeClass("item-active");
                            $this.parent().addClass("item-active");
                        }
                    });
                }
            });
            $("button").button();
            $(document).keydown(function(event){
                if($.browser.msie && event.keyCode == 116){
                    logout();
                }
            });
        });
        defaultPostSuccess($("#response-param>div:first-child"));
        function logout(){
            window.location.href='<%=getFullPath(request, "index.jsp?logout=true")%>';
        }
    </script>
</html>